home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / create6r / frmlogin.frm (.txt) < prev    next >
Visual Basic Form  |  1999-02-19  |  3KB  |  109 lines

  1. VERSION 5.00
  2. Begin VB.Form frmLogin 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "Login"
  5.    ClientHeight    =   1590
  6.    ClientLeft      =   45
  7.    ClientTop       =   330
  8.    ClientWidth     =   3750
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    MinButton       =   0   'False
  12.    ScaleHeight     =   1590
  13.    ScaleWidth      =   3750
  14.    ShowInTaskbar   =   0   'False
  15.    StartUpPosition =   2  'CenterScreen
  16.    Tag             =   "Login"
  17.    Begin VB.CommandButton cmdCancel 
  18.       Cancel          =   -1  'True
  19.       Caption         =   "Cancel"
  20.       Height          =   360
  21.       Left            =   2100
  22.       TabIndex        =   5
  23.       Tag             =   "Cancel"
  24.       Top             =   1020
  25.       Width           =   1140
  26.    End
  27.    Begin VB.CommandButton cmdOK 
  28.       Caption         =   "OK"
  29.       Default         =   -1  'True
  30.       Height          =   360
  31.       Left            =   495
  32.       TabIndex        =   4
  33.       Tag             =   "OK"
  34.       Top             =   1020
  35.       Width           =   1140
  36.    End
  37.    Begin VB.TextBox txtPassword 
  38.       Height          =   285
  39.       IMEMode         =   3  'DISABLE
  40.       Left            =   1305
  41.       PasswordChar    =   "*"
  42.       TabIndex        =   1
  43.       Top             =   525
  44.       Width           =   2325
  45.    End
  46.    Begin VB.TextBox txtUserName 
  47.       Height          =   285
  48.       Left            =   1305
  49.       TabIndex        =   3
  50.       Top             =   135
  51.       Width           =   2325
  52.    End
  53.    Begin VB.Label lblLabels 
  54.       Caption         =   "&Password:"
  55.       Height          =   248
  56.       Index           =   1
  57.       Left            =   105
  58.       TabIndex        =   0
  59.       Tag             =   "&Password:"
  60.       Top             =   540
  61.       Width           =   1080
  62.    End
  63.    Begin VB.Label lblLabels 
  64.       Caption         =   "&User Name:"
  65.       Height          =   248
  66.       Index           =   0
  67.       Left            =   105
  68.       TabIndex        =   2
  69.       Tag             =   "&User Name:"
  70.       Top             =   150
  71.       Width           =   1080
  72.    End
  73. Attribute VB_Name = "frmLogin"
  74. Attribute VB_GlobalNameSpace = False
  75. Attribute VB_Creatable = False
  76. Attribute VB_PredeclaredId = True
  77. Attribute VB_Exposed = False
  78. Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpbuffer As String, nSize As Long) As Long
  79. Public OK As Boolean
  80. Private Sub Form_Load()
  81.     Dim sBuffer As String
  82.     Dim lSize As Long
  83.     sBuffer = Space$(255)
  84.     lSize = Len(sBuffer)
  85.     Call GetUserName(sBuffer, lSize)
  86.     If lSize > 0 Then
  87.         txtUserName.Text = Left$(sBuffer, lSize)
  88.     Else
  89.         txtUserName.Text = vbNullString
  90.     End If
  91. End Sub
  92. Private Sub cmdCancel_Click()
  93.     OK = False
  94.     Me.Hide
  95. End Sub
  96. Private Sub cmdOK_Click()
  97.     'To Do - create test for correct password
  98.     'check for correct password
  99.     If txtPassword.Text = "" Then
  100.         OK = True
  101.         Me.Hide
  102.     Else
  103.         MsgBox "Invalid Password, try again!", , "Login"
  104.         txtPassword.SetFocus
  105.         txtPassword.SelStart = 0
  106.         txtPassword.SelLength = Len(txtPassword.Text)
  107.     End If
  108. End Sub
  109.